#include "Airport.h"
#include <math.h>
Airport::Airport()
{
    agent = new Agent(0.9, 0.1, 0.5, 1000, 4);
    planesInAirspaceMax = 20;
}

void Airport::updateCongestion(vector<vector<Edge> > edges)
{
    //Find all the agents that are within 10 of the airport and add it to the congestion.
    int total = 0;
    for(unsigned int i = 0; i < edges.size(); i++)
    {
        Edge curEdge = edges[i][airportNum];
        for(unsigned int j = 0; j < curEdge.airplanes.size(); j++)
        {
            if(curEdge.airplanes[j]->edgeLoc >= curEdge.length - 10)
            {
                total++;
            }
        }
    }
    planesInAirspace = total;
}

Actions Airport::getAction(State* state, vector<int> possibleActions)
{
    int action = agent->getAction(state, possibleActions);
    if(action == 0) return RouteFirst;
    if(action == 1) return RouteSecond;
    if(action == 2) return RouteThird;
    if(action == 3) return Delay;
}
Airport::~Airport()
{
    //dtor
}
